package com.heima.article.controller.v1;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.article.service.ApArticleContentService;
import com.heima.model.article.pojos.ApArticleContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/api/v1/article_content")
public class ApArticleContentController {
    @Autowired
    ApArticleContentService apArticleContentService;

    /**
     * 根据文章id查询文章内容
     *
     * @param articleId
     * @return
     */
    @GetMapping("/one/{id}")
    public ApArticleContent findArticleContentById(@PathVariable("id") Long articleId) {
        return apArticleContentService.getOne(Wrappers.<ApArticleContent>lambdaQuery()
                .eq(ApArticleContent::getArticleId, articleId));
    }
}
